﻿using Domain.Entitys;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore
{
    public class MyDbContext:DbContext
    {
        /// <summary>
        /// 配置链接字符串
        /// </summary>
        /// <param name="optionsBuilder"></param>
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //链接字符串
            string connStr = "Data Source=.;Initial Catalog=HR_DB;Integrated Security=True;Connect Timeout=30;Encrypt=False;";
            optionsBuilder.UseSqlServer(connStr);
        }

        /// <summary>
        /// 读取配置类
        /// </summary>
        /// <param name="modelBuilder"></param>
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            //程序集
            modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);

        }

        public DbSet<User> Users { get; set; }
        public DbSet<CFFK> CFFKs { get; set; }
        public DbSet<CFSK> CFSKs { get; set; }
        public DbSet<CFTK> CFTKs { get; set; }
        public DbSet<CMK> CMKs { get; set; }
        public DbSet<CM> cMs { get; set; }
        public DbSet <CPC>CPC { get; set; }
        public DbSet <SSD> SSD { get; set; }
        public DbSet <SS> SS { get; set; }
        public DbSet<EMR> EMRs { get; set; }
        public DbSet<HF> HF { get; set; }
        public DbSet<SG> SG { get; set; }
        public DbSet<SGD> SGD { get; set; }
        public DbSet<ER> ER { get; set; }
        public DbSet<HFD> HFD { get; set; }
        public DbSet<MC> MC { get; set; }
        public DbSet<RolesJurisdiction> RolesJurisdictions { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<Jurisdiction> Jurisdictions { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
		public DbSet<EI> EI { get; set; }
	}
}
